//
//  YFDongtaiModel.m
//  project
//
//  Created by yefei on 2019/4/15.
//  Copyright © 2019 健健. All rights reserved.
//

#import "YFDongtaiModel.h"

@implementation YFDongtaiFileModel

- (NSString *)yy_modelDescription {
    return [self yy_modelDescription];
}

@end



@implementation YFDongtaiRecordModel

+ (nullable NSDictionary<NSString *, id> *)modelContainerPropertyGenericClass {
    return @{
             @"files": [YFDongtaiFileModel class],
             };
}

- (BOOL)modelCustomTransformFromDictionary:(NSDictionary *)dic {
    
    [self transformProperties];
    
    return YES;
}

- (NSString *)yy_modelDescription {
    return [self yy_modelDescription];
}

#pragma mark - 加工数据
- (void)transformProperties {
    
    // 解析 预览图片
    if (self.files.count) {
        YFDongtaiFileModel *file = self.files.firstObject;
        self.isImage = [file.fileType isEqualToString:@"image"];
        if (self.isImage) {
            self.previewImageName = file.url;
        } else {
            self.previewImageName = file.thumbnail;
        }
    }
}
@end



@implementation YFDongtaiModel
+ (nullable NSDictionary<NSString *, id> *)modelContainerPropertyGenericClass {
    return @{
             @"records": [YFDongtaiRecordModel class],
             };
}

- (NSString *)yy_modelDescription {
    return [self yy_modelDescription];
}

@end
